package textbasedapp;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;

public class CmdLineArgs {

	public static void main(String[] args) {
		if (args.length == 0) {
			System.out.println("No Arguments. Sorry.");
			return;
		}

		for (int i = 0; i < args.length; i++) {

			System.out.println("***********************");

			try {
				Integer.parseInt(args[i]);
				System.out.println(args[i] + " is parsed to an Integer.");
				continue;
			} catch (NumberFormatException e) {
				System.out.println(String.format("%s is not a Integer number",
						args[i]));
			}

			try {
				Double.parseDouble(args[i]);
				System.out.println(args[i] + " is parsed to a Double.");
				continue;
			} catch (NumberFormatException e) {
				System.out.println(String.format("%s is not a Double number",
						args[i]));
			}

			try {
				DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
				df.parse(args[i]);
				System.out.println(args[i] + " is parsed to a Date.");
				continue;
			} catch (ParseException e) {
				System.out.println(String.format("%s is not a Date", args[i]));
			}

		}
	}

}
